﻿

using OpenCvSharp;

using System;

using Xc.DataAccess.CodeReader.Properties;
using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models.Filters
{
    /// <summary>
    /// 将图像转换为灰度图
    /// </summary>
    [Filter("颜色转换", FilterType.Algorithm)]
    public class AlgorithmColorConverter : FilterBase
    {

      /// <summary>
                 
        /// 颜色转换参数
                 
        /// </summary>
        [InputParameter("颜色转换参数")]
        public ColorConversionCodes ColorConversionCodes { get; set; }
        /// <summary>
        /// 颜色深度
        /// </summary>
        [InputParameter("颜色深度")]
        public int DntCount { get; set; }
        internal override ResultData<Mat> UseChannel(Mat mat, FilterBase[] filterBases, FilterBase preFilterBase)
        {
            Mat mat1 = new Mat();
            Cv2.CvtColor(mat, mat1, ColorConversionCodes, DntCount);
            return ResultData<Mat>.Accept(TextResource.convert_image_success, mat1);
        }
    }
}
